/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package imagemanip.structures;
import java.awt.Color;

/**
 *
 * @author clotilde
 */
public class OcTreeElement implements java.lang.Comparable {
    private Color rgb;
    private int occurrences; // Nombre d'occurrences de pixels ayant la couleur rgb

    public OcTreeElement(Color c, int n) {
        this.rgb = c;
        this.occurrences = n;
    }

    public Color getCouleur(){
        return rgb;
    }

    public int getOccurence(){
        return occurrences;
    }

    public void setOccurrence(int n){
        this.occurrences = n;
    }

    public int compareTo(Object other) {
        int n1 = ((OcTreeElement) other).getOccurence();
        int n2 = this.getOccurence();
        if (n1 > n2) return -1;
        else if (n1 == n2) return 0;
             else return 1;
    }

    @Override
    public String toString() {
        return ("OcTreeElement [" + rgb.toString() + "," + occurrences + "]");
    }


}
